{include file="lib/header.html" type="register" title="用户注册" }
  <div id="container">
    <div class="register-box clearfix">
      <div class="register-left">
        <div class="register-head clearfix">
          <div class="r-h-inner">
            <a href="javascript:void(0);" class="curr">手机号注册</a>
            <a href="javascript:void(0);">邮箱注册</a>
          </div>
        </div>
          <div class="input-box phone">
            <form action="{AnUrl('user/register/save')}" method="post" id="js_register_m">
              <p class="clearfix"><span class="name">用户名：</span><span class="txt-wrap clearfix"><input type="text" value="" name="username" id="js_usernameM" class="txt txt1"/></span><span id="username_error_m" class="span1"></span></p>
              <p class="clearfix"><span class="name">手机号：</span><span class="txt-wrap clearfix"><input type="text" value="" name="mobile" id="js_mobileM" class="txt txt1"/></span><a href="javascript:void(0);" class="btn1 validation-code clearfix"><!-- <em class="time hidden">60</em> --><em class="obtain" id="getCode" value="on">获取验证码</em></a></p>
              <p class="clearfix"><span class="name">验证码：</span><span class="txt-wrap clearfix"><input type="text" value="" name="code" id="js_codeM" class="txt txt2"/></span><span id="code_error_m" class="span1">请输入手机收到的验证码</span></p>
              <p class="clearfix"><span class="name">设置密码：</span><span class="txt-wrap clearfix"><input type="password" value="" name="password" id="js_pwM" class="txt txt1"/></span><span id="pw_error_m" class="span1"></span></p>
              <p class="clearfix"><span class="name">确认密码：</span><span class="txt-wrap clearfix"><input type="password" value="" id="js_repwM" name="repassword" class="txt txt1"/></span><span id="repw_error_m" class="span1"></span></p>
              <p class="clearfix"><a href="javascript:void(0);" class="btn2 register-btn" id="register-mobile">立即注册</a><span class="span2">点击“立即注册”，即表示您同意并愿意遵守用户协议</span></p>
            </form>
          </div>
        <div class="input-box email hidden">
          <form action="{AnUrl('user/register/save')}" method="post" id="js_register_e">
            <p class="clearfix"><span class="name">用户名：</span><span class="txt-wrap clearfix"><input type="text" value="" name="username" id="js_usernameE" class="txt txt1"/></span><span id="username_error_e" class="span1"></span></p>
            <p class="clearfix"><span class="name">邮箱：</span><span class="txt-wrap clearfix"><input type="text" value="" name="email" id="js_emailE" class="txt txt1"/></span><span id="email_error_e" class="span1"></span></p>
            <p class="clearfix"><span class="name">设置密码：</span><span class="txt-wrap clearfix"><input type="password" name="password"  id="js_pwE" value="" class="txt txt1"/></span><span id="pw_error_e" class="span1"></span></p>
            <p class="clearfix"><span class="name">确认密码：</span><span class="txt-wrap clearfix"><input type="password" name="repassword"  id="js_repwE" value="" class="txt txt1"/></span><span id="repw_error_e" class="span1"></span></p>
            <p class="clearfix"><a href="javascript:void(0);" class="btn2 register-btn" id="register-email">立即注册</a><span class="span2">点击“立即注册”，即表示您同意并愿意遵守用户协议</span></p>
          </form>
        </div>
      </div>
      <div class="register-rigth">
        <p class="tit">或者使用合作账号登录</p>
        <div class="social">
          <a href="{AnUrl('openapi/sinaweibo/index')}" class="sina"></a>
          <a href="{AnUrl('openapi/qqconnect/login')}" class="qq"></a>
          <a href="{AnUrl('openapi/baiduconnect/login')}" class="baidu"></a>
          <a href="{AnUrl('openapi/weixin/web/login')}" class="weixin"></a>
        </div>
        <p class="lx-login"><a href="{AnUrl('openapi/lenovo/index')}">联想通行证登录</a></p>
      </div>
    </div>
    {include_core file="lib/bottom_copy.html"}
  </div>
</div>
<div class="black-shade hidden"></div>
<div class="float-img-validation hidden">
  <div class="top">
    <h2 class="tit">图片验证码</h2>
    <a href="javascript:void(0);" class="close"></a>
  </div>
  <div class="input-box">
    <p class="img-box"><img src="../images/validation-code.png" width="303" height="76"></p>
    <p><span class="txt-wrap clearfix"><input type="text" value="输入图像中的字符，不区分大小写" class="txt txt1"/></span></p>
    <p><a href="javascript:void(0);" class="btn1 submit-btn">提交</a></p>
  </div>
</div>
<script>
$(function(){
  var user_off = mobile_off = email_off = code_off = pw_off = repw_off = 1;
  $('#js_usernameM, #js_usernameE').blur(function(){
    var username = $.trim($(this).val());
    var userLen  = getStringLen(username);
    var userNext = $(this).parent().next();
    if(username == '') {
      user_off = 1;
      userNext.addClass('prompt-red').html('用户名不能为空');
      return ;
    } else {
      userNext.html('');
    }
    if(checkStr(username, 'mail')) {
      user_off = 1;
      userNext.addClass('prompt-red').html('用户名不能为邮箱！');
      return ;
    } else {
      userNext.html('');
    }
    if(userLen < 6 || userLen > 20) {
      user_off = 1;
      userNext.addClass('prompt-red').html('用户名应在6个到20个字符之间');
      return ;
    } else {
      userNext.html('');
    }
    if(!checkStr(username, 'name')) {
      user_off = 1;
      userNext.addClass('prompt-red').html('用户名格式不正确');
      return ;
    } else {
      userNext.html('');
    }
    if(is_number(username)) {
      user_off = 1;
      userNext.addClass('prompt-red').html('用户名不能为纯数字');
      return ;
    } else {
      userNext.html('');
    }
    $.post(
        "{AnUrl('user/register/ajax_username')}",
        { username:username },
        function(data){
          if(data.info == 'error') {
            userNext.addClass('prompt-red').html(data.msg);
            user_off = 1;
            return;
          } else {
            user_off = 0;
            userNext.html('');
          }
        },'json');
  });

  $('#js_emailE').blur(function(){
    var email = $.trim($(this).val());
    var emailNext = $(this).parent().next();
    if(email == '') {
      email_off = 1;
      emailNext.addClass('prompt-red').html('邮箱不能为空');
      return ;
    } else {
      emailNext.html('');
    }
    if(!checkStr(email, 'mail')) {
      email_off = 1;
      emailNext.addClass('prompt-red').html('邮箱格式不正确');
      return ;
    } else {
      emailNext.html('');
    }
    $.post(
        "{AnUrl('user/register/ajax_email')}",
        { email:email },
        function(data) {
          if(data.info == 'error') {
            emailNext.addClass('prompt-red').html(data.msg);
            email_off = 1;
            return ;
          } else {
            email_off = 0;
            emailNext.html('');
          }
        },'json'
    )
  });

  $('#js_mobileM').blur(function(){
    var mobile = $.trim($(this).val());
    var mobileNext = $('#js_codeM').parent().next();
    if(mobile == '') {
      mobile_off = 1;
      mobileNext.addClass('prompt-red').html('手机号不能为空');
      return ;
    } else {
      mobileNext.html('');
    }
    if(!checkStr(mobile, 'mobile')) {
      mobile_off = 1;
      mobileNext.addClass('prompt-red').html('手机号格式不正确');
      return ;
    } else {
      mobileNext.html('');
    }
    $.post(
        "{AnUrl('user/register/ajax_mobile')}",
        { mobile:mobile },
        function(data) {
          if(data.info == 'error') {
            mobileNext.addClass('prompt-red').html(data.msg);
            mobile_off = 1;
            return;
          } else {
            mobile_off = 0;
            mobileNext.html('');
          }
        },'json'
    );
  });

  $('#js_codeM').blur(function(){
    var code = $.trim($(this).val());
    var mobile = $.trim($('#js_mobileM').val());
    var codeNext = $('#js_codeM').parent().next();
    if(mobile == '') {
      mobile_off = 1;
      codeNext.addClass('prompt-red').html('手机号不能为空');
      return ;
    } else {
      codeNext.html('');
    }
    if(!checkStr(mobile, 'mobile')) {
      code_off = 1;
      codeNext.addClass('prompt-red').html('手机号格式不正确');
      return ;
    } else {
      codeNext.html('');
    }
    if(code == '') {
      code_off = 1;
      codeNext.addClass('prompt-red').html('验证码不能为空');
      return ;
    } else {
      codeNext.html('');
    }
    $.post(
        "{AnUrl('user/register/ajax_code')}",
        { code:code, mobile:mobile, code_type:'register' },
        function(data) {
          if(data.info == 'error') {
            codeNext.addClass('prompt-red').html(data.msg);
            code_off = 1;
            return;
          } else {
             code_off = 0;
             codeNext.html('');
          }
        },'json'
    );
  })

  $('#js_pwM, #js_pwE').blur(function(){
    var pw       = $.trim($(this).val());
    var pwNext   = $(this).parent().next();
    if(pw == '') {
      pw_off = 1;
      pwNext.addClass('prompt-red').html('密码不能为空');
      return ;
    } else {
      pwNext.html('');
    }
    if(getStringLen(pw) < 6) {
      pw_off = 1;
      pwNext.addClass('prompt-red').html('密码最少要6位字符');
      return ;
    } else {
      pwNext.html('');
    }
    if(getStringLen(pw) >= 20) {
      pw_off = 1;
      pwNext.addClass('prompt-red').html('密码最多20位字符');
      return ;
    } else {
      pwNext.html('');
    }
    pw_off = 0;
  });

  $('#js_repwM').blur(function(){
    var pw       = $.trim($('#js_pwM').val());
    var repw     = $.trim($(this).val());
    var repwNext = $(this).parent().next();
    if(repw == '') {
      repwNext.addClass('prompt-red').html('确认密码不能为空');
      return ;
    } else {
      repwNext.html('');
    }
    if(pw != repw) {
      repwNext.addClass('prompt-red').html('两次输入密码不一致');
      return ;
    } else {
      repwNext.html('');
    }
    repw_off = 0;
  })
  $('#js_repwE').blur(function(){
    var pw       = $.trim($('#js_pwE').val());
    var repw     = $.trim($(this).val());
    var repwNext = $(this).parent().next();
    if(repw == '') {
      repw_off = 1;
      repwNext.addClass('prompt-red').html('确认密码不能为空');
      return ;
    } else {
      repwNext.html('');
    }
    if(pw != repw) {
      repw_off = 1;
      repwNext.addClass('prompt-red').html('两次输入密码不一致');
      return ;
    } else {
      repwNext.html('');
    }
    repw_off = 0;
  })

  $('#register-mobile').click(function(){
    $(this).html('正在提交...');
    $('#js_usernameM').trigger('blur');
    $('#js_mobileM').trigger('blur');
    $('#js_codeM').trigger('blur');
    $('#js_pwM').trigger('blur');
    $('#js_repwM').trigger('blur');
    if(0 == user_off && 0 == mobile_off && 0 == code_off && 0 == pw_off && 0 == repw_off ) {
      $('#js_register_m').submit();
    } else {
      user_off = mobile_off = code_off = pw_off = repw_off = 1;
      $(this).html('立即注册');
    }
  });
  
  $('#register-email').click(function(){
    $(this).html('正在提交...');
    $('#js_usernameE').trigger('blur');
    $('#js_emailE').trigger('blur');
    $('#js_pwE').trigger('blur');
    $('#js_repwE').trigger('blur');
    if(user_off == 0 && email_off == 0 && pw_off == 0 && repw_off == 0) {
      $('#js_register_e').submit();
    } else {
      user_off = email_off = pw_off = repw_off = 1;
      $(this).html('立即注册');
    }
  });
//获取验证码
  $('#getCode').click(function(){
    var mobile = $.trim($('#js_mobileM').val());
    $('#js_usernameM').trigger('blur');
    $('#js_mobileM').trigger('blur');
    var codeNext = $('#js_codeM').parent().next();
    if(user_off == 0 && mobile_off == 0) {
      if($(this).attr('value') == 'on') {
        var time = 59;
        $('#getCode').html(time).attr('value', 'off');
        var Timer=setInterval(function(){
          if(time > 0){
            time--;
            $('#getCode').html(time).attr('value', 'off');
          } else {
            $('#getCode').html('获取验证码').attr('value', 'on');
            clearInterval(Timer);
          }
        },1000);
      $.post(
          "{AnUrl('user/register/sendRegsms')}",
          { 'mobile':mobile, 'send_type':'register' },
          function(data){
            if(data.info == 'error') {
              codeNext.addClass('prompt-red').html(data.msg);
            } else {
              codeNext.html('');
            }
          },'json');
      }
    }
  });
});
</script>
<script language="JavaScript" type="text/javascript"><!--
/* You may give each page an identifying name, server, and channel on
the next lines. */
s.pageName="Nbd:注册";
s.server=""
s.channel="Nbd"
s.pageType=""
s.prop1="Nbd:注册";
s.prop2="Nbd:注册";
s.prop3="Nbd:注册";
s.prop4="Nbd:注册";
/* Conversion Variables */
s.campaign=""
s.state=""
s.zip=""
s.events="";
s.products="";
s.purchaseID=""
s.eVar1=""
s.eVar2=""
s.eVar3=""
s.eVar4=""
s.eVar5=""
/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code)//--></script>
<script language="JavaScript" type="text/javascript"><!--
if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
//--></script><noscript><img src="http://lenovochina.122.2o7.net/b/ss/lenovo-nbd-prd/1/H.26.2--NS/0"
height="1" width="1" border="0" alt="" /></noscript><!--/DO NOT REMOVE/-->
<!-- End SiteCatalyst code version: H.26.2. -->
{include file="lib/footer.html"}